/*
 * DateControl.h
 *
 *  Created on: 2011-1-10
 *      Author: Administrator
 */

#ifndef DATECONTROL_H_
#define DATECONTROL_H_

#include "BaseControl.h"
#include <EIKMFNE.H> 

class CDateControl : public CBaseControl
	{
public:
    static CDateControl* NewL(const TRect& aRect,const CCoeControl* aParent);
	static CDateControl* NewLC(const TRect& aRect,const CCoeControl* aParent);
	virtual ~CDateControl();
	
public:
	TInt CountComponentControls() const;
	CCoeControl* ComponentControl( TInt aIndex ) const;
	TKeyResponse OfferKeyEventL( 
				const TKeyEvent& aKeyEvent, 
				TEventCode aType );
	void HandlePointerEventL(const TPointerEvent& aPointerEvent);
	
public:
	void setDate(const TDesC& aDate);
	const TDesC& Date();
	void setListen(TBool aValue);
	void Draw(CWindowGc& gc, const TRect& aRect) const;
	
protected:
	CDateControl();
	void ConstructL(const TRect& aRect,const CCoeControl* aParent);
	void FocusChanged(TDrawNow aDrawNow);
	
private:
	void CreateDateEditor(const TRect& aRect);
	void startTimer();
	void stopTimer();
	void IsChangeDate();
	static TInt CallBack(TAny* aPtr);

private:
	CEikDateEditor* iDateEditor;
	CPeriodic* iTimer;
	TBool iListening;
	TBuf<32> iDateText;
	};

#endif /* DATECONTROL_H_ */
